package org.example.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 * 点赞记录表，用于存储用户对作品的点赞信息
 * </p>
 *
 * @author zhx
 * @since 2025-01-17
 */
@TableName("likes")
public class Likes implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 点赞记录ID，自增主键，用于唯一标识每条点赞记录
     */
    @TableId(value = "like_id", type = IdType.AUTO)
    private Integer likeId;

    /**
     * 用户ID，点赞的用户，关联users表的user_id
     */
    @TableField("user_id")
    private Integer userId;

    /**
     * 作品ID，被点赞的作品，关联works表的work_id
     */
    @TableField("work_id")
    private Integer workId;

    /**
     * 点赞时间，默认当前时间，记录用户点赞的具体时间
     */
    @TableField("like_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime likeTime;

    public Integer getLikeId() {
        return likeId;
    }

    public void setLikeId(Integer likeId) {
        this.likeId = likeId;
    }
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public Integer getWorkId() {
        return workId;
    }

    public void setWorkId(Integer workId) {
        this.workId = workId;
    }
    public LocalDateTime getLikeTime() {
        return likeTime;
    }

    public void setLikeTime(LocalDateTime likeTime) {
        this.likeTime = likeTime;
    }

    @Override
    public String toString() {
        return "Likes{" +
            "likeId=" + likeId +
            ", userId=" + userId +
            ", workId=" + workId +
            ", likeTime=" + likeTime +
        "}";
    }
}
